'use strict';
module.exports = {
	/**
	 * 此函数名称
	 * @url client/user/pub/test 前端调用的url参数地址
	 * data 请求参数
	 * @params {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, originalParam } = event;
		let { customUtil, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code : 0, msg : '' };
		// 业务逻辑开始-----------------------------------------------------------
		// 可写与数据库的交互逻辑等等
		
		let index_data = await vk.baseDao.selects({
		  dbName: "daoju_classification",
		  getCount: false,
		  pageIndex: 1,
		  pageSize: 20,
		  // 主表where条件
		  whereJson: {
		    
		  },
		  // 主表字段显示规则
		  fieldJson: {},
		  // 主表排序规则
		  sortArr: [{ name:"sort", type:"asc" }],
		  // 副表列表
		  foreignDB: [
		    {
		      dbName: "daoju_merchandise",
			  whereJson:{
				status:1  
			  },
		      localKey: "_id",
		      foreignKey: "classification_id",
		      as: "product_list",
		      limit: 6
		    }
		  ]
		});
		
		res.data =index_data

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
